<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <title>简历展示</title>
    <meta charset="UTF-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <style>
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            line-height: 1.6;
            color: #333;
            max-width: 900px;
            margin: 0 auto;
            padding: 20px;
            background-color: #f9f9f9;
        }
        .header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 30px;
            padding-bottom: 20px;
            border-bottom: 2px solid #3498db;
        }
        .profile {
            display: flex;
            align-items: center;
            gap: 20px;
        }
        .avatar {
            border-radius: 50%;
            border: 3px solid #3498db;
            object-fit: cover;
        }
        .contact-info {
            background-color: #f0f8ff;
            padding: 15px;
            border-radius: 5px;
            margin-bottom: 20px;
        }
        .contact-info p {
            margin: 5px 0;
        }
        h1 {
            color: #2c3e50;
            margin: 0;
        }
        h2 {
            color: #3498db;
            border-bottom: 1px solid #ddd;
            padding-bottom: 5px;
            margin-top: 25px;
        }
        h3 {
            color: #7f8c8d;
            margin: 5px 0 15px;
        }
        ul {
            padding-left: 20px;
        }
        li {
            margin-bottom: 15px;
            list-style-type: none;
            position: relative;
            padding-left: 20px;
        }
        li:before {
            content: "•";
            color: #3498db;
            font-weight: bold;
            position: absolute;
            left: 0;
        }
        b {
            color: #2c3e50;
        }
        .section {
            background-color: white;
            padding: 20px;
            border-radius: 5px;
            box-shadow: 0 2px 5px rgba(0,0,0,0.1);
            margin-bottom: 20px;
        }
        .upload-form {
            margin-top: 10px;
            padding: 10px;
            background-color: #f0f8ff;
            border-radius: 5px;
        }
        button {
            background-color: #3498db;
            color: white;
            border: none;
            padding: 8px 15px;
            border-radius: 4px;
            cursor: pointer;
            transition: background-color 0.3s;
        }
        button:hover {
            background-color: #2980b9;
        }
        input[type="file"] {
            margin: 10px 0;
        }
    </style>
</head>
<body>
<div class="header">
    <div>
        <h1 th:text="${user.name}">姓名</h1>
        <h3 th:text="'应聘岗位: ' + ${user.position_applied}"></h3>
    </div>
    <div class="profile">
        <img class="avatar" th:src="@{'/images/' + ${user.avatar_path}}" width="100" height="100" alt="头像"/>
    </div>
</div>

<div class="section contact-info">
    <p><strong>电话:</strong> <span th:text="${user.phone}"></span></p>
    <p><strong>邮箱:</strong> <span th:text="${user.email}"></span></p>
    <p><strong>地址:</strong> <span th:text="${user.address}"></span></p>

    <div class="upload-form">
        <form th:action="@{'/updateAvatar/'+${user.id.toString()}}" method="post" enctype="multipart/form-data">
            <label for="file"><strong>更新头像:</strong></label><br>
            <input type="file" name="file">
            <button type="submit">上传</button>
        </form>
    </div>
</div>

<div class="section">
    <h2>教育背景</h2>
    <ul th:each="edu : ${educations}">
        <li>
            <b th:text="${edu.start_date} + ' - ' + ${edu.end_date}"></b>
            <span th:text="${edu.school_name} + ' | ' + ${edu.major}"></span><br/>
            <i th:text="${edu.degree}"></i>
        </li>
    </ul>
</div>

<div class="section">
    <h2>工作经历</h2>
    <ul th:each="work : ${workExperiences}">
        <li>
            <b th:text="${work.start_date} + ' - ' + ${work.end_date}"></b>
            <span th:text="${work.company_name} + ' | ' + ${work.job_title}"></span><br/>
            <i th:text="${work.description}"></i>
        </li>
    </ul>
</div>

<div class="section">
    <h2>校园经历</h2>
    <ul th:each="campus : ${campusExperiences}">
        <li>
            <b th:text="${campus.start_date} + ' - ' + ${campus.end_date}"></b>
            <span th:text="${campus.organization} + ' | ' + ${campus.position}"></span>
        </li>
    </ul>
</div>

<div class="section">
    <h2>技能与证书</h2>
    <ul th:each="skill : ${skills}">
        <li th:text="${skill.certificate_name}"></li>
    </ul>
</div>

<div class="section">
    <h2>自我评价</h2>
    <p th:text="${evaluation.content}"></p>
</div>

</body>
</html>